package com.handle.common.log;

import com.handle.common.log.aspect.OperateLogAspect;
import com.handle.common.log.listen.LogListener;
import com.handle.system.api.feign.RemoteSystemLoginLog;
import com.handle.system.api.feign.RemoteSystemOperateLog;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;


/**
 * @author zhangqing
 * @version V1.0
 * @description log自动转配类
 * @date 6/3/2021 12:49 PM
 */
@EnableAsync
@Configuration
@AllArgsConstructor
@ConditionalOnWebApplication
public class LogAutoConfiguration {

    private final RemoteSystemLoginLog systemLoginLog;
    public final RemoteSystemOperateLog systemOperateLog;

    @Bean
    public LogListener sysLogListener() {
        return new LogListener(systemLoginLog,systemOperateLog);
    }

    @Bean
    public OperateLogAspect operateLogAspect(){
        return new OperateLogAspect();
    }
}
